<?php


namespace app\common\lists;

trait ListsSortTrait
{

    protected $sort;

    /**
     * @param $sortField
     * @param $defaultOrder
     * @return array
     */
    private function createSort($sortFields, $order, $sort)
    {

        if (!$sortFields) {
            $this->sort = [$order => $sort];
        } else {
            $order = [$order => $sort];
            foreach ($sortFields as $k => $v) {
                $order[$k] = $v;
            }
            $this->sort = $order;
        }
    }
}